<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="years" placeholder="年份">
    <input type="text" id="month" placeholder="月份">
    <input type="text" name="" id="days" placeholder="天数">
    <button id="btn">查询</button>
    <script>
        var years = document.getElementById("years");
        var month = document.getElementById("month");
        var days = document.getElementById("days");
        var btn = document.getElementById("btn");
        btn.onclick = function () {
            var res = 0;
            var feb = 0;
            var mon = parseInt(month.value);
            if ( years.value % 400 == 0 || ( years.value % 4 == 0 && years.value % 100 != 0) ) {
                feb = feb ;
            } else {
                feb = 28 ;
            }
            switch ( mon ) {
                    case 1:
                        res = parseInt(days.value);
                        break;
                    case 2:
                        res = 31 + parseInt(days.value);
                        break;
                    case 3:
                        res = 31 + feb + parseInt(days.value);
                        break;
                    case 4:
                        res = 31 + feb + 31 + parseInt(days.value);
                        break;
                    case 5:
                        res = 31 + feb + 31 + 30 + parseInt(days.value);
                        break; 
                    case 6:
                        res = 31 + feb + 31 + 30 + 31 + parseInt(days.value);
                        break; 
                    case 7:
                        res = 31 + feb + 31 + 30 + 31 + 30 + parseInt(days.value);
                        break;   
                    case 8:
                        res = 31 + feb + 31 + 30 + 31 + 30 + 31 + parseInt(days.value);
                        break;
                    case 9:
                        res = 31 + feb + 31 + 30 + 31 + 30 + 31 + 31 + parseInt(days.value);
                        break;      
                    case 10:
                        res = 31 + feb + 31 + 30 + 31 + 30 + 31 + 31 + 30 + parseInt(days.value);
                        break;  
                    case 11:
                        res = 31 + feb + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + parseInt(days.value);
                        break;  
                    case 12:
                        res = 31 + feb + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + parseInt(days.value);
                        break;    
            }
            window.alert("这是" + years.value + "第" + res + "天");
        }
    </script>
</body>
</html>